package com.easy.west.westclient.api.constacts.api;

import android.content.Context;
import android.support.annotation.NonNull;

import com.easy.west.westclient.api.base.callback.BaseCallBack;
import com.easy.west.westclient.api.base.impl.BaseImpl;
import com.easy.west.westclient.api.constacts.bean.HumanList;
import com.easy.west.westclient.api.constacts.bean.PersonInfo;
import com.easy.west.westclient.api.constacts.event.FindAllHumanEvent;
import com.easy.west.westclient.api.constacts.event.FindHumanByDepEvent;
import com.easy.west.westclient.api.constacts.event.FindOnePersonEvent;
import com.easy.west.westclient.api.constacts.event.FindPersonByUid;
import com.easy.west.westclient.api.constacts.event.FindPersonisBundleEvent;
import com.easy.west.westclient.api.constacts.event.QueryConstactsEvent;
import com.easy.west.westclient.util.UUIDGenerator;

/**
 * Created by xiatao on 2018/8/15.
 */

public class ConstantsImpl extends BaseImpl<ConstactsService> implements ConstactsApi {
    public ConstantsImpl(@NonNull Context context) {
        super(context);
    }

    /**
     * 注释见接口规范
     * @return
     */
    @Override
    public String findAllPeople() {
        String uuid = UUIDGenerator.getUUID();
        service.findAllPeople().enqueue(new BaseCallBack<HumanList>(new FindAllHumanEvent(uuid)));
        return uuid;
    }

    @Override
    public String findPeopleinfo(long aid) {
        String uuid = UUIDGenerator.getUUID();
        service.findPeopleinfo(aid).enqueue(new BaseCallBack<PersonInfo>(new FindOnePersonEvent(uuid)));
        return uuid;
    }

    @Override
    public String findPeopleByDepartMent(long did) {
        String uuid = UUIDGenerator.getUUID();
        service.findPeopleByDepartMent(did).enqueue(new BaseCallBack<HumanList>(new FindHumanByDepEvent(uuid)));
        return uuid;
    }

    @Override
    public String findConstactsisLink(long aid) {
        String uuid = UUIDGenerator.getUUID();
        service.findPeopleislink(aid).enqueue(new BaseCallBack<Boolean>(new FindPersonisBundleEvent(uuid)));
        return uuid;
    }

    @Override
    public String queryConstacts(String user_name) {
        String uuid = UUIDGenerator.getUUID();
        service.queryCosntacts(user_name).enqueue(new BaseCallBack<HumanList>(new QueryConstactsEvent(uuid)));
        return uuid;
    }

    @Override
    public String findConstactsbyuid(long uid) {
        String uuid = UUIDGenerator.getUUID();
        service.findpersonbyuid(uid).enqueue(new BaseCallBack<PersonInfo>(new FindPersonByUid(uuid)));
        return uuid;
    }
}
